#include "dinnerthread.h"
#include <QDebug>
DinnerThread::DinnerThread(QSemaphore *semaphore, int index)
{
    this->semaphore = semaphore;
    this->index = index;
}

void DinnerThread::run()
{
    semaphore->acquire(1);
      qDebug() <<QStringLiteral("No.")<< index
              <<QStringLiteral(":开始用餐");
      QThread::sleep(3);//表示用餐时间
      qDebug()<<QStringLiteral("No.")<< index
              << QStringLiteral(":用餐结束");
    semaphore->release(1);
}
